
/* Generated by Interface Builder */

#import "ColorLabApp.h"
#import <objc/objc.h>		/* for BOOL values YES, NO */
#import <appkit/color.h>
#import <appkit/NXColorWell.h>
#import <appkit/Matrix.h>

@implementation ColorLabApp

- appDidInit:sender
{
	[myColorWell setContinuous:YES];	/* not needed */
	[myColorWell activate:(int)YES];	/* activate */
	[self orderFrontColorPanel:self];
	return self;
}


// Action methond for the ColorWell
- showColorInNumbers:sender
{
int i;
NXColor color;
float cmpnts[5];

    color =[sender color];
    // update the HSBA number display
    NXConvertColorToHSBA(color, &cmpnts[0], &cmpnts[1], &cmpnts[2], &cmpnts[3]);
    for(i=0; i<4; i++)
	[[hsbaMatrix findCellWithTag:i] setFloatValue: cmpnts[i]];
    // doit for RGBA representation
    NXConvertColorToRGBA(color, &cmpnts[0], &cmpnts[1], &cmpnts[2], &cmpnts[3]);
    for(i=0; i<4; i++)
	[[rgbaMatrix findCellWithTag:i] setFloatValue: cmpnts[i]];
    // doit for CMYKA representation
    NXConvertColorToCMYKA(color, &cmpnts[0], &cmpnts[1], &cmpnts[2], &cmpnts[3], &cmpnts[4]);
    for(i=0; i<5; i++)
	[[cmykaMatrix findCellWithTag:i] setFloatValue: cmpnts[i]];

    return self;
}

@end
